<?php
// Copyright 2008 Datapolis Solutions OY
// 
// This file is part of a program, that is distributed
// under the terms of the GNU General Public License,
// see license.txt for details.


/**
* IDPFormBlock is an interface!?!?
*/
interface IDPFormBlock {
	
	/**
	* Get headers for html head.
	* 
	* @return string.
	*/
	public function getHeaders(  );
	
	/**
	* Get editor (HTML, CSS, Javascript) for the form block.
	* Return value
	*   array(
	*     'html'       => '<div></div>',
	*     'css'        => '<style></style>',
	*     'javascript' => '<script></script>',
	*   )
	* 
	* @param  string  $formID  ID attribute of the form.
	* @param  int     $id      Null or an id of the stored item.
	* @return mixed            Array or false on failure.
	*/
	public function getEditor( $formID, $id=null );
	
	/**
	* Gets values from sent form and validates the received values.
	* If this fails call getEditor() and show the form again.
	* 
	* @return boolean
	*/
	public function loadFormData(  );
	
	/**
	* Store data which was loaded from the sent form.
	* 
	* @param  int  $id  An id of the stored item.
	* @return boolean
	*/
	public function storeFormData( $id );
	
	/**
	* Get view (HTML, CSS, Javascript) for the saved data.
	* Return value
	*   array(
	*     'html'       => '<div></div>',
	*     'css'        => '<style></style>',
	*     'javascript' => '<script></script>',
	*   )
	* 
	* @param  int  $id  An id of the stored item.
	* @return mixed     Array or false on failure.
	*/
	public function getView( $id );
	
	/**
	* Remove all data related to the passed id.
	* 
	* @param  int  $id  An id of the stored item.
	* @return boolean
	*/
	public function remove( $id );
	
	/**
	* True if object has an error message.
	* 
	* @return boolean
	*/
	public function hasError(  );
	
	/**
	* Get error string.
	* 
	* @return string
	*/
	public function getError(  );
}

?>